package com.den.service.impl.impl;

import com.den.entity.Video;
import com.den.mapper.VideoMapper;
import com.den.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class VideoServiceImpl implements VideoService {
    //实现所有的方法，快捷方式
    //因为service依赖mapper 所以建立一个mapper属性
    //在类名上加注解@Service
    //修改各个方法中的逻辑，具体用mapper中的方法实现

    @Autowired//自动装配
    private VideoMapper videoMapper;
    @Override
    public List<Video> selectAllVideos() {
        return videoMapper.selectAllVideos();
    }

    @Override
    public List selectVideoById(int id) {
        return videoMapper.selectVideoById(id);
    }

    @Override
    public Boolean deleteVideoById(int id) {
        return videoMapper.deleteVideoById(id)>0;
    }

    @Override
    public Boolean insertVideoById(Video video) {
        return videoMapper.insertVideoById(video)>0;
    }

    @Override
    public Boolean updateVideoById(Video video) {
        return videoMapper.updateVideoById(video)>0;
    }
}
